#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      Jack Kelly
#
# Created:     04/07/2012
# Copyright:   (c) Student 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------
import random

class Card:
    def __init__(self, suit, value):
        self.cardsuit=suit
        self.cardvalue=value
        if (value=="Jack"):
            self.actualvalue=11
        elif (value=="Queen"):
            self.actualvalue=12
        elif (value=="King"):
            self.actualvalue=13
        elif (value=="Ace"):
            self.actualvalue=14
        else:
            self.actualvalue=int(value)

    def compareCard(self, cardCompare):

        if (self.actualvalue>cardCompare.actualvalue):
            print("Your card is greater")
        if (self.actualvalue<cardCompare.actualvalue):
            print("Your opponents card is greater")
        if (self.actualvalue==cardCompare.actualvalue):
            if (self.cardsuit>cardCompare.cardsuit):
                print("Your card is greater")
            if (self.cardsuit<cardCompare.cardsuit):
                print("Your opponents card is greater")
            if (self.cardsuit==cardCompare.cardsuit):
                print("You have the same card!")

def main():
    suits=["Clubs", "Diamonds", "Hearts", "Spades"]
    values=[]
    for i in range(2,11): #the way for loops work in python
        values.append(str(i))
    faces=["Jack", "Queen", "King", "Ace"]
    values.extend(faces)
    deck=[]
    for i in suits:
        for e in values:
            addCard=Card(i, e)
            deck.append(addCard)
    random.shuffle(deck)
    card1=deck[0]
    card2=deck[1]
    print ("Your card is:\t\t\t\t" + deck[0].cardvalue + " of " + deck[0].cardsuit)
    print ("Your opponent's card is:\t" + deck[1].cardvalue + " of " + deck[1].cardsuit)
    card1.compareCard(card2)

if __name__ == '__main__':
    main()
